<?php


class FieldNamePositionBehavior extends ModelBehavior {

//var $settings = array();

//function setup(&$Model, $settings = array()) {
//	//$this->settings[$Model->name] = (array)$settings;
//	//$Model->Behaviors->attach('Position.Positionable', $settings); // wrap / dima
//}

//function _strictPosition(&$Model, $value) {
//	return !empty($value) ? $value : NULL;
//}
//
//function getPosition(&$Model, $id = NULL) {
//	return $Model->hasField('position') ? (int)$Model->getField('position', $id) : NULL;
//}
//
//function setPosition(&$Model, $value, $id = NULL) {
//	return $Model->hasField('position') ? $Model->setField('position', $this->_strictPosition($Model, (int)$value), $id) : FALSE;
//}
//
//function nullPosition(&$Model, $id = NULL) {
//	return $Model->hasField('position') ? $Model->setField('position', NULL, $id) : FALSE;
//}

function first(&$Model, $id = NULL) {
	//return $this->top($Model, $id);
	return $Model->positionFirst($id);
}

function top(&$Model, $id = NULL) { // deprecated
	//return $Model->toTop($id);
	return $Model->positionFirst($id);
}

function up(&$Model, $id = NULL) {
	//return $Model->up($id);
	return $Model->positionUp($id);
}

function down(&$Model, $id = NULL) {
	//return $Model->down($id);
	return $Model->positionDown($id);
}

function bottom(&$Model, $id = NULL) { // deprecated
	//return $Model->toBottom($id);
	return $Model->positionLast($id);
}

function last(&$Model, $id = NULL) {
	//return $this->bottom($Model, $id);
	return $Model->positionLast($id);
}

function before(&$Model, $id = NULL, $neighbor_id = NULL) {
	//return $Model->insertBefore($id);
	return $Model->positionBefore($id, $neighbor_id);
}

function after(&$Model, $id = NULL, $neighbor_id = NULL) {
	//return $Model->insertAfter($id);
	return $Model->positionAfter($id, $neighbor_id);
}

}


?>